<?php 
class DomArHistoryTestClass_Item extends DomArObject {

	/**
	* @orm text
	*/
	public $title;
	/**
	* @orm longtext
	*/
	public $description;
	/**
	 * @orm has parent DomArHistoryTestClass_User inverse items
	 */
	public $user;
	/**
	 * @orm has history DomArHistoryTestClass_ItemHistory inverse item
	 */
	public $history;
}

class DomArHistoryTestClass_User extends DomArObject {
	
	/**
	* @orm text
	*/
	public $username;
	/**
	 * @orm has many DomArHistoryTestClass_Item inverse user
	 */
	public $items;
}


class DomArHistoryTestClass_ItemHistory extends DomArHistoryItem {
	
	/**
	 * @orm text
	 */
	public $title;
	/**
	 * @orm longtext
	 */
	public $description;
	/**
	 * @orm int(11)
	 * @orm listener beforeValidate beforeValidateUser
	 */
	public $user;
	/**
	 * @orm has parent DomArHistoryTestClass_Item inverse history
	 */
	public $item;
	
	public function beforeValidateUser( &$value ) {
		if( is_object($value) )
			$value = $value->id;
			
		return $value;
	}
	
	public function getUserRestoreValue() {
		return DomArHistoryTestClass_User::load($this->user);
	}
		
}
?>